import { ElMessage } from 'element-plus';

const message = (isSuccess: boolean, message: string) => ElMessage({ message: `${message}${isSuccess ? '成功' : '失败'}！`, type: isSuccess ? 'success' : 'warning' });

const generatBasePath = function () {
  const BASE_URL = import.meta.env.VITE_APP_BASE_URL;
  return BASE_URL.search(/https/i) !== -1
    ? `${import.meta.env.VITE_APP_OFFICE_WEB365}hide=1&draw=3&ssl=1&`
    : `${import.meta.env.VITE_APP_OFFICE_WEB365}hide=1&draw=3&`
}

const utils = { message, generatBasePath };

export default utils;
